﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Tetris
{
  public class Renderer
    {
      List<PieceOfBlocks> block { get; set; }
      


        public virtual void RenderField(GameField field)// Рисуем главное игровое поле
        {
            
            Console.CursorVisible = false;
            Console.Clear();
           
            for (int i = 0; i < field.width; i++)
            {
                for (int j = 0; j < field.lenght; j++)
                {
                    
                    Console.ForegroundColor = ConsoleColor.Blue;
                    if (i == 0 || i == field.width - 1)
                        Console.Write("0");

                    else if (j == 0 || j == field.lenght - 1)
                        Console.Write("0");

                    else Console.Write(" ");
                    Console.ResetColor();
                }


                Console.WriteLine();

            }

           

           
        }

        public void RenderBlock(List<PieceOfBlocks> blocK)
        {
            this.block = blocK;
            for(int i = 0; i < 4; i++)
            {
                Console.ForegroundColor = ConsoleColor.Green;
                Console.SetCursorPosition(block[i].X, block[i].Y);
                Console.Write("X");
                Console.ResetColor();
            }

        }

      /* internal void RenderBlock(Action<int, int> action)
        {
            throw new NotImplementedException();
        }*/
    }
}
